home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / tools / Mesa-3.0 / SRC / TYPES.H < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-24  |  49.3 KB  |  1,486 lines

  1. /* $Id: types.h,v 3.27 1998/08/23 22:19:30 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  3.0
  6.  * Copyright (C) 1995-1998  Brian Paul
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25.  * $Log: types.h,v $
  26.  * Revision 3.27  1998/08/23 22:19:30  brianp
  27.  * added DoViewportMapping to context struct
  28.  *
  29.  * Revision 3.26  1998/08/21 02:41:55  brianp
  30.  * changed PolygonStipple function pointer param type to GLuint *
  31.  *
  32.  * Revision 3.25  1998/08/21 01:49:29  brianp
  33.  * added vertex array TexCoordInterleaveFactor
  34.  *
  35.  * Revision 3.24  1998/07/29 04:10:01  brianp
  36.  * added extra texture state fields for glPush/PopAttrib()
  37.  *
  38.  * Revision 3.23  1998/07/17 03:23:32  brianp
  39.  * added Pixel.ScaleOrBiasRGBA field
  40.  *
  41.  * Revision 3.22  1998/06/21 02:00:28  brianp
  42.  * renamed clip interpolator function.  cleaned-up comments
  43.  *
  44.  * Revision 3.21  1998/06/07 22:18:52  brianp
  45.  * implemented GL_EXT_multitexture extension
  46.  *
  47.  * Revision 3.20  1998/06/02 23:51:04  brianp
  48.  * added CHAN_BITS and GLchan type (for the future)
  49.  *
  50.  * Revision 3.19  1998/04/20 23:55:13  brianp
  51.  * applied DavidB's changes for v0.25 of 3Dfx driver
  52.  *
  53.  * Revision 3.18  1998/03/28 03:58:40  brianp
  54.  * added CONST macro to fix IRIX compilation problems
  55.  *
  56.  * Revision 3.17  1998/03/27 04:27:05  brianp
  57.  * changed a few evaluator members from GLuint to GLint to fix G++ warnings
  58.  *
  59.  * Revision 3.16  1998/03/22 16:42:05  brianp
  60.  * added 8-bit CI->RGBA pixel mapping tables
  61.  *
  62.  * Revision 3.15  1998/03/15 17:55:54  brianp
  63.  * added FogMode to context struct
  64.  *
  65.  * Revision 3.14  1998/03/01 20:18:14  brianp
  66.  * removed unused context fields
  67.  *
  68.  * Revision 3.13  1998/02/21 01:01:29  brianp
  69.  * added GL_MAX_TEXTURES constant
  70.  *
  71.  * Revision 3.12  1998/02/20 04:53:07  brianp
  72.  * implemented GL_SGIS_multitexture
  73.  *
  74.  * Revision 3.11  1998/02/13 04:38:05  brianp
  75.  * optimized blending functions called via BlendFunc function pointer
  76.  *
  77.  * Revision 3.10  1998/02/13 03:23:04  brianp
  78.  * AlphaRef is now a GLubyte
  79.  *
  80.  * Revision 3.9  1998/02/13 03:17:02  brianp
  81.  * added basic stereo support
  82.  *
  83.  * Revision 3.8  1998/02/08 20:19:41  brianp
  84.  * ColorMask is now GLubyte[4] instead of GLuint
  85.  *
  86.  * Revision 3.7  1998/02/03 23:46:40  brianp
  87.  * added 'space' parameter to clip interpolation functions
  88.  *
  89.  * Revision 3.6  1998/02/03 04:27:54  brianp
  90.  * added texture lod clamping
  91.  *
  92.  * Revision 3.5  1998/02/02 03:09:34  brianp
  93.  * added GL_LIGHT_MODEL_COLOR_CONTROL (separate specular color interpolation)
  94.  *
  95.  * Revision 3.4  1998/02/01 22:20:25  brianp
  96.  * minor clean-up
  97.  *
  98.  * Revision 3.3  1998/02/01 20:05:10  brianp
  99.  * added glDrawRangeElements()
  100.  *
  101.  * Revision 3.2  1998/02/01 19:39:09  brianp
  102.  * added GL_CLAMP_TO_EDGE texture wrap mode
  103.  *
  104.  * Revision 3.1  1998/02/01 16:37:19  brianp
  105.  * added GL_EXT_rescale_normal extension
  106.  *
  107.  * Revision 3.0  1998/01/31 21:05:58  brianp
  108.  * initial rev
  109.  *
  110.  */
  111.  
  112.  
  113. #ifndef TYPES_H
  114. #define TYPES_H
  115.  
  116.  
  117. #include "GL/gl.h"
  118. #include "config.h"
  119. #include "macros.h"
  120. #include "fixed.h"
  121.  
  122.  
  123. #define GL_MAX_TEXTURES GL_MAX_TEXTURES_SGIS
  124.  
  125.  
  126. /*
  127.  * Color channel data type:
  128.  */
  129. #if CHAN_BITS==8
  130.    typedef GLubyte GLchan;
  131. #elif CHAN_BITS==16
  132.    typedef GLushort GLchan;
  133. #else
  134.    illegal number of color channel bits
  135. #endif
  136.  
  137.  
  138. /*
  139.  * Accumulation buffer data type:
  140.  */
  141. #if ACCUM_BITS==8
  142.    typedef GLbyte GLaccum;
  143. #elif ACCUM_BITS==16
  144.    typedef GLshort GLaccum;
  145. #else
  146.    illegal number of accumulation bits
  147. #endif
  148.  
  149.  
  150. /*
  151.  * Stencil buffer data type:
  152.  */
  153. #if STENCIL_BITS==8
  154.    typedef GLubyte GLstencil;
  155. #else
  156.    illegal number of stencil bits
  157. #endif
  158.  
  159.  
  160. /*
  161.  * Depth buffer data type:
  162.  */
  163. #if DEPTH_BITS==16
  164.    typedef GLushort GLdepth;
  165. #elif DEPTH_BITS==32
  166.    typedef GLint GLdepth;
  167. #else
  168.    illegal number of depth bits
  169. #endif
  170.  
  171.  
  172.  
  173.  
  174.  
  175. struct HashTable;
  176.  
  177. typedef struct gl_visual GLvisual;
  178.  
  179. typedef struct gl_context GLcontext;
  180.  
  181. typedef struct gl_frame_buffer GLframebuffer;
  182.  
  183.  
  184.  
  185. /*
  186.  * Point, line, triangle, quadrilateral and rectangle rasterizer functions:
  187.  */
  188. typedef void (*points_func)( GLcontext *ctx, GLuint first, GLuint last );
  189.  
  190. typedef void (*line_func)( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv );
  191.  
  192. typedef void (*triangle_func)( GLcontext *ctx,
  193.                                GLuint v1, GLuint v2, GLuint v3, GLuint pv );
  194.  
  195. typedef void (*quad_func)( GLcontext *ctx, GLuint v1, GLuint v2,
  196.                            GLuint v3, GLuint v4, GLuint pv );
  197.  
  198. typedef void (*rect_func)( GLcontext *ctx, GLint x, GLint y,
  199.                            GLint width, GLint height );
  200.  
  201. /*
  202.  * The auxiliary interpolation function for clipping
  203.  */
  204. typedef void (*clip_interp_func)( GLcontext *ctx, GLuint space, GLuint dst,
  205.                                   GLfloat t, GLuint in, GLuint out );
  206.  
  207.  
  208.  
  209. /*
  210.  * Blending function
  211.  */
  212. typedef void (*blend_func)( GLcontext *ctx, GLuint n, const GLubyte mask[],
  213.                             GLubyte src[][4], CONST GLubyte dst[][4] );
  214.  
  215.  
  216.  
  217. /*
  218.  * For texture sampling:
  219.  */
  220. struct gl_texture_object;
  221.  
  222. typedef void (*TextureSampleFunc)( const struct gl_texture_object *tObj,
  223.                                    GLuint n,
  224.                                    const GLfloat s[], const GLfloat t[],
  225.                                    const GLfloat u[], const GLfloat lambda[],
  226.                                    GLubyte rgba[][4] );
  227.  
  228.  
  229.  
  230. /* Generic internal image format */
  231. struct gl_image {
  232.     GLint Width;
  233.     GLint Height;
  234.     GLint Depth;        /* for 3-D texturing */
  235.     GLint Components;    /* 1, 2, 3 or 4 */
  236.         GLenum Format;        /* GL_COLOR_INDEX, GL_RED, GL_RGB, etc */
  237.     GLenum Type;        /* GL_UNSIGNED_BYTE or GL_FLOAT or GL_BITMAP */
  238.     GLvoid *Data;
  239.     GLboolean ErrorFlag;
  240.     GLint RefCount;
  241. };
  242.  
  243.  
  244.  
  245. /* Texture image record */
  246. struct gl_texture_image {
  247.     GLenum Format;        /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA,
  248.                  * GL_INTENSITY, GL_RGB, GL_RGBA, or
  249.                  * GL_COLOR_INDEX
  250.                  */
  251.     GLenum IntFormat;    /* Internal format as given by the user */
  252.     GLuint Border;        /* 0 or 1 */
  253.     GLuint Width;        /* = 2^WidthLog2 + 2*Border */
  254.     GLuint Height;        /* = 2^HeightLog2 + 2*Border */
  255.     GLuint Depth;        /* = 2^DepthLog2 + 2*Border */
  256.     GLuint Width2;        /* = Width - 2*Border */
  257.     GLuint Height2;        /* = Height - 2*Border */
  258.     GLuint Depth2;        /* = Depth - 2*Border */
  259.     GLuint WidthLog2;    /* = log2(Width2) */
  260.     GLuint HeightLog2;    /* = log2(Height2) */
  261.     GLuint DepthLog2;    /* = log2(Depth2) */
  262.     GLuint MaxLog2;        /* = MAX(WidthLog2, HeightLog2) */
  263.     GLubyte *Data;        /* Image data as unsigned bytes */
  264.  
  265.     /* For device driver: */
  266.     void *DriverData;    /* Arbitrary device driver data */
  267. };
  268.  
  269.  
  270.  
  271. /*
  272.  * All gl* API functions in api*.c jump through pointers in this struct.
  273.  */
  274. struct gl_api_table {
  275.    void (*Accum)( GLcontext *, GLenum, GLfloat );
  276.    void (*AlphaFunc)( GLcontext *, GLenum, GLclampf );
  277.    GLboolean (*AreTexturesResident)( GLcontext *, GLsizei,
  278.                                      const GLuint *, GLboolean * );
  279.    void (*ArrayElement)( GLcontext *, GLint );
  280.    void (*Begin)( GLcontext *, GLenum );
  281.    void (*BindTexture)( GLcontext *, GLenum, GLuint );
  282.    void (*Bitmap)( GLcontext *, GLsizei, GLsizei, GLfloat, GLfloat,
  283.              GLfloat, GLfloat, struct gl_image *bitmap );
  284.    void (*BlendColor)( GLcontext *, GLclampf, GLclampf, GLclampf, GLclampf);
  285.    void (*BlendEquation)( GLcontext *, GLenum );
  286.    void (*BlendFunc)( GLcontext *, GLenum, GLenum );
  287.    void (*CallList)( GLcontext *, GLuint list );
  288.    void (*CallLists)( GLcontext *, GLsizei, GLenum, const GLvoid * );
  289.    void (*Clear)( GLcontext *, GLbitfield );
  290.    void (*ClearAccum)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
  291.    void (*ClearColor)( GLcontext *, GLclampf, GLclampf, GLclampf, GLclampf );
  292.    void (*ClearDepth)( GLcontext *, GLclampd );
  293.    void (*ClearIndex)( GLcontext *, GLfloat );
  294.    void (*ClearStencil)( GLcontext *, GLint );
  295.    void (*ClipPlane)( GLcontext *, GLenum, const GLfloat * );
  296.    void (*Color3f)( GLcontext *, GLfloat, GLfloat, GLfloat );
  297.    void (*Color3fv)( GLcontext *, const GLfloat * );
  298.    void (*Color4f)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
  299.    void (*Color4fv)( GLcontext *, const GLfloat * );
  300.    void (*Color4ub)( GLcontext *, GLubyte, GLubyte, GLubyte, GLubyte );
  301.    void (*Color4ubv)( GLcontext *, const GLubyte * );
  302.    void (*ColorMask)( GLcontext *,
  303.             GLboolean, GLboolean, GLboolean, GLboolean );
  304.    void (*ColorMaterial)( GLcontext *, GLenum, GLenum );
  305.    void (*ColorPointer)( GLcontext *, GLint, GLenum, GLsizei, const GLvoid * );
  306.    void (*ColorTable)( GLcontext *, GLenum, GLenum, struct gl_image * );
  307.    void (*ColorSubTable)( GLcontext *, GLenum, GLsizei, struct gl_image * );
  308.    void (*CopyPixels)( GLcontext *, GLint, GLint, GLsizei, GLsizei, GLenum );
  309.    void (*CopyTexImage1D)( GLcontext *, GLenum, GLint, GLenum,
  310.                            GLint, GLint, GLsizei, GLint );
  311.    void (*CopyTexImage2D)( GLcontext *, GLenum, GLint, GLenum,
  312.                            GLint, GLint, GLsizei, GLsizei, GLint );
  313.    void (*CopyTexSubImage1D)( GLcontext *, GLenum, GLint, GLint,
  314.                               GLint, GLint, GLsizei );
  315.    void (*CopyTexSubImage2D)( GLcontext *, GLenum, GLint, GLint, GLint,
  316.                               GLint, GLint, GLsizei, GLsizei );
  317.    void (*CopyTexSubImage3DEXT)(GLcontext *,
  318.                                 GLenum , GLint ,
  319.                                 GLint , GLint , GLint ,
  320.                                 GLint , GLint ,
  321.                                 GLsizei , GLsizei  );
  322.    void (*CullFace)( GLcontext *, GLenum );
  323.    void (*DeleteLists)( GLcontext *, GLuint, GLsizei );
  324.    void (*DeleteTextures)( GLcontext *, GLsizei, const GLuint *);
  325.    void (*DepthFunc)( GLcontext *, GLenum );
  326.    void (*DepthMask)( GLcontext *, GLboolean );
  327.    void (*DepthRange)( GLcontext *, GLclampd, GLclampd );
  328.    void (*Disable)( GLcontext *, GLenum );
  329.    void (*DisableClientState)( GLcontext *, GLenum );
  330.    void (*DrawArrays)( GLcontext *, GLenum, GLint, GLsizei );
  331.    void (*DrawBuffer)( GLcontext *, GLenum );
  332.    void (*DrawElements)( GLcontext *, GLenum, GLsizei, GLenum, const GLvoid *);
  333.    void (*DrawPixels)( GLcontext *, struct gl_image *image );
  334.    void (*DrawRangeElements)( GLcontext *, GLenum, GLuint, GLuint, GLsizei,
  335.                               GLenum, const GLvoid * );
  336.    void (*EdgeFlag)( GLcontext *, GLboolean );
  337.    void (*EdgeFlagPointer)( GLcontext *, GLsizei, const GLboolean * );
  338.    void (*Enable)( GLcontext *, GLenum );
  339.    void (*EnableClientState)( GLcontext *, GLenum );
  340.    void (*End)( GLcontext * );
  341.    void (*EndList)( GLcontext * );
  342.    void (*EvalCoord1f)( GLcontext *, GLfloat );
  343.    void (*EvalCoord2f)( GLcontext *, GLfloat , GLfloat );
  344.    void (*EvalMesh1)( GLcontext *, GLenum, GLint, GLint );
  345.    void (*EvalMesh2)( GLcontext *, GLenum, GLint, GLint, GLint, GLint );
  346.    void (*EvalPoint1)( GLcontext *, GLint );
  347.    void (*EvalPoint2)( GLcontext *, GLint, GLint );
  348.    void (*FeedbackBuffer)( GLcontext *, GLsizei, GLenum, GLfloat * );
  349.    void (*Finish)( GLcontext * );
  350.    void (*Flush)( GLcontext * );
  351.    void (*Fogfv)( GLcontext *, GLenum, const GLfloat * );
  352.    void (*FrontFace)( GLcontext *, GLenum );
  353.    void (*Frustum)( GLcontext *, GLdouble, GLdouble, GLdouble, GLdouble,
  354.                     GLdouble, GLdouble );
  355.    GLuint (*GenLists)( GLcontext *, GLsizei );
  356.    void (*GenTextures)( GLcontext *, GLsizei, GLuint * );
  357.    void (*GetBooleanv)( GLcontext *, GLenum, GLboolean * );
  358.    void (*GetClipPlane)( GLcontext *, GLenum, GLdouble * );
  359.    void (*GetColorTable)( GLcontext *, GLenum, GLenum, GLenum, GLvoid *);
  360.    void (*GetColorTableParameteriv)( GLcontext *, GLenum, GLenum, GLint *);
  361.    void (*GetDoublev)( GLcontext *, GLenum, GLdouble * );
  362.    GLenum (*GetError)( GLcontext * );
  363.    void (*GetFloatv)( GLcontext *, GLenum, GLfloat * );
  364.    void (*GetIntegerv)( GLcontext *, GLenum, GLint * );
  365.    const GLubyte* (*GetString)( GLcontext *, GLenum name );
  366.    void (*GetLightfv)( GLcontext *, GLenum light, GLenum, GLfloat * );
  367.    void (*GetLightiv)( GLcontext *, GLenum light, GLenum, GLint * );
  368.    void (*GetMapdv)( GLcontext *, GLenum, GLenum, GLdouble * );
  369.    void (*GetMapfv)( GLcontext *, GLenum, GLenum, GLfloat * );
  370.    void (*GetMapiv)( GLcontext *, GLenum, GLenum, GLint * );
  371.    void (*GetMaterialfv)( GLcontext *, GLenum, GLenum, GLfloat * );
  372.    void (*GetMaterialiv)( GLcontext *, GLenum, GLenum, GLint * );
  373.    void (*GetPixelMapfv)( GLcontext *, GLenum, GLfloat * );
  374.    void (*GetPixelMapuiv)( GLcontext *, GLenum, GLuint * );
  375.    void (*GetPixelMapusv)( GLcontext *, GLenum, GLushort * );
  376.    void (*GetPointerv)( GLcontext *, GLenum, GLvoid ** );
  377.    void (*GetPolygonStipple)( GLcontext *, GLubyte * );
  378.    void (*PrioritizeTextures)( GLcontext *, GLsizei, const GLuint *,
  379.                                const GLclampf * );
  380.    void (*GetTexEnvfv)( GLcontext *, GLenum, GLenum, GLfloat * );
  381.    void (*GetTexEnviv)( GLcontext *, GLenum, GLenum, GLint * );
  382.    void (*GetTexGendv)( GLcontext *, GLenum coord, GLenum, GLdouble * );
  383.    void (*GetTexGenfv)( GLcontext *, GLenum coord, GLenum, GLfloat * );
  384.    void (*GetTexGeniv)( GLcontext *, GLenum coord, GLenum, GLint * );
  385.    void (*GetTexImage)( GLcontext *, GLenum, GLint level, GLenum, GLenum,
  386.                         GLvoid * );
  387.    void (*GetTexLevelParameterfv)( GLcontext *,
  388.                      GLenum, GLint, GLenum, GLfloat * );
  389.    void (*GetTexLevelParameteriv)( GLcontext *,
  390.                      GLenum, GLint, GLenum, GLint * );
  391.    void (*GetTexParameterfv)( GLcontext *, GLenum, GLenum, GLfloat *);
  392.    void (*GetTexParameteriv)( GLcontext *, GLenum, GLenum, GLint * );
  393.    void (*Hint)( GLcontext *, GLenum, GLenum );
  394.    void (*IndexMask)( GLcontext *, GLuint );
  395.    void (*Indexf)( GLcontext *, GLfloat c );
  396.    void (*Indexi)( GLcontext *, GLint c );
  397.    void (*IndexPointer)( GLcontext *, GLenum, GLsizei, const GLvoid * );
  398.    void (*InitNames)( GLcontext * );
  399.    void (*InterleavedArrays)( GLcontext *, GLenum, GLsizei, const GLvoid * );
  400.    GLboolean (*IsEnabled)( GLcontext *, GLenum );
  401.    GLboolean (*IsList)( GLcontext *, GLuint );
  402.    GLboolean (*IsTexture)( GLcontext *, GLuint );
  403.    void (*LightModelfv)( GLcontext *, GLenum, const GLfloat * );
  404.    void (*Lightfv)( GLcontext *, GLenum light, GLenum, const GLfloat *, GLint);
  405.    void (*LineStipple)( GLcontext *, GLint factor, GLushort );
  406.    void (*LineWidth)( GLcontext *, GLfloat );
  407.    void (*ListBase)( GLcontext *, GLuint );
  408.    void (*LoadIdentity)( GLcontext * );
  409.    /* LoadMatrixd implemented with glLoadMatrixf */
  410.    void (*LoadMatrixf)( GLcontext *, const GLfloat * );
  411.    void (*LoadName)( GLcontext *, GLuint );
  412.    void (*LogicOp)( GLcontext *, GLenum );
  413.    void (*Map1f)( GLcontext *, GLenum, GLfloat, GLfloat, GLint, GLint,
  414.           const GLfloat *, GLboolean );
  415.    void (*Map2f)( GLcontext *, GLenum, GLfloat, GLfloat, GLint, GLint,
  416.           GLfloat, GLfloat, GLint, GLint, const GLfloat *,
  417.           GLboolean );
  418.    void (*MapGrid1f)( GLcontext *, GLint, GLfloat, GLfloat );
  419.    void (*MapGrid2f)( GLcontext *, GLint, GLfloat, GLfloat,
  420.             GLint, GLfloat, GLfloat );
  421.    void (*Materialfv)( GLcontext *, GLenum, GLenum, const GLfloat * );
  422.    void (*MatrixMode)( GLcontext *, GLenum );
  423.    /* MultMatrixd implemented with glMultMatrixf */
  424.    void (*MultMatrixf)( GLcontext *, const GLfloat * );
  425.    void (*NewList)( GLcontext *, GLuint list, GLenum );
  426.    void (*Normal3f)( GLcontext *, GLfloat, GLfloat, GLfloat );
  427.    void (*Normal3fv)( GLcontext *, const GLfloat * );
  428.    void (*NormalPointer)( GLcontext *, GLenum, GLsizei, const GLvoid * );
  429.    void (*Ortho)( GLcontext *, GLdouble, GLdouble, GLdouble, GLdouble,
  430.                   GLdouble, GLdouble );
  431.    void (*PassThrough)( GLcontext *, GLfloat );
  432.    void (*PixelMapfv)( GLcontext *, GLenum, GLint, const GLfloat * );
  433.    void (*PixelStorei)( GLcontext *, GLenum, GLint );
  434.    void (*PixelTransferf)( GLcontext *, GLenum, GLfloat );
  435.    void (*PixelZoom)( GLcontext *, GLfloat, GLfloat );
  436.    void (*PointParameterfvEXT)( GLcontext *, GLenum, const GLfloat * );
  437.    void (*PointSize)( GLcontext *, GLfloat );
  438.    void (*PolygonMode)( GLcontext *, GLenum, GLenum );
  439.    void (*PolygonOffset)( GLcontext *, GLfloat, GLfloat );
  440.    void (*PolygonStipple)( GLcontext *, const GLuint * );
  441.    void (*PopAttrib)( GLcontext * );
  442.    void (*PopClientAttrib)( GLcontext * );
  443.    void (*PopMatrix)( GLcontext * );
  444.    void (*PopName)( GLcontext * );
  445.    void (*PushAttrib)( GLcontext *, GLbitfield );
  446.    void (*PushClientAttrib)( GLcontext *, GLbitfield );
  447.    void (*PushMatrix)( GLcontext * );
  448.    void (*PushName)( GLcontext *, GLuint );
  449.    void (*RasterPos4f)( GLcontext *,
  450.                         GLfloat x, GLfloat y, GLfloat z, GLfloat w );
  451.    void (*ReadBuffer)( GLcontext *, GLenum );
  452.    void (*ReadPixels)( GLcontext *, GLint, GLint, GLsizei, GLsizei, GLenum,
  453.              GLenum, GLvoid * );
  454.    void (*Rectf)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
  455.    GLint (*RenderMode)( GLcontext *, GLenum );
  456.    void (*Rotatef)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
  457.    void (*Scalef)( GLcontext *, GLfloat, GLfloat, GLfloat );
  458.    void (*Scissor)( GLcontext *, GLint, GLint, GLsizei, GLsizei);
  459.    void (*SelectBuffer)( GLcontext *, GLsizei, GLuint * );
  460.    void (*ShadeModel)( GLcontext *, GLenum );
  461.    void (*StencilFunc)( GLcontext *, GLenum, GLint, GLuint );
  462.    void (*StencilMask)( GLcontext *, GLuint );
  463.    void (*StencilOp)( GLcontext *, GLenum, GLenum, GLenum );
  464.    void (*TexCoord2f)( GLcontext *, GLfloat, GLfloat );
  465.    void (*TexCoord4f)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
  466.    void (*TexCoordPointer)( GLcontext *, GLint, GLenum, GLsizei,
  467.                             const GLvoid *);
  468.    void (*TexEnvfv)( GLcontext *, GLenum, GLenum, const GLfloat * );
  469.    void (*TexGenfv)( GLcontext *, GLenum coord, GLenum, const GLfloat * );
  470.    void (*TexImage1D)( GLcontext *, GLenum, GLint, GLint, GLsizei,
  471.                        GLint, GLenum, GLenum, struct gl_image * );
  472.    void (*TexImage2D)( GLcontext *, GLenum, GLint, GLint, GLsizei, GLsizei,
  473.                        GLint, GLenum, GLenum, struct gl_image * );
  474.    void (*TexSubImage1D)( GLcontext *, GLenum, GLint, GLint, GLsizei,
  475.                           GLenum, GLenum, struct gl_image * );
  476.    void (*TexSubImage2D)( GLcontext *, GLenum, GLint, GLint, GLint,
  477.                           GLsizei, GLsizei, GLenum, GLenum,
  478.                           struct gl_image * );
  479.    void (*TexImage3DEXT)(GLcontext *,
  480.                          GLenum , GLint , GLint ,
  481.                          GLsizei , GLsizei , GLsizei ,
  482.                          GLint ,
  483.                          GLenum , GLenum ,
  484.                          struct gl_image * );
  485.    void (*TexSubImage3DEXT)(GLcontext *,
  486.                             GLenum , GLint ,
  487.                             GLint , GLint , GLint,
  488.                             GLsizei , GLsizei , GLsizei ,
  489.                             GLenum , GLenum ,
  490.                             struct gl_image * );
  491.    void (*TexParameterfv)( GLcontext *, GLenum, GLenum, const GLfloat * );
  492.    /* Translated implemented by Translatef */
  493.    void (*Translatef)( GLcontext *, GLfloat, GLfloat, GLfloat );
  494.    void (*Vertex2f)( GLcontext *, GLfloat, GLfloat );
  495.    void (*Vertex3f)( GLcontext *, GLfloat, GLfloat, GLfloat );
  496.    void (*Vertex4f)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
  497.    void (*Vertex3fv)( GLcontext *, const GLfloat * );
  498.    void (*VertexPointer)( GLcontext *, GLint, GLenum, GLsizei, const GLvoid *);
  499.    void (*Viewport)( GLcontext *, GLint, GLint, GLsizei, GLsizei );
  500.  
  501.    /* GL_MESA_window_pos extension */
  502.    void (*WindowPos4fMESA)( GLcontext *, GLfloat, GLfloat, GLfloat, GLfloat );
  503.  
  504.    /* GL_MESA_resize_buffers extension */
  505.    void (*ResizeBuffersMESA)( GLcontext * );
  506.  
  507.    /* GL_SGIS_multitexture / GL_EXT_multitexture */
  508.    void (*MultiTexCoord4f)( GLcontext *, GLenum, GLfloat, GLfloat, GLfloat, GLfloat );
  509.    void (*MultiTexCoordPointer)( GLcontext *, GLenum, GLint, GLenum, GLsizei, const GLvoid *);
  510.    void (*InterleavedTextureCoordSets)( GLcontext *, GLint );
  511.    void (*SelectTextureSGIS)( GLcontext *, GLenum );
  512.    void (*SelectTexture)( GLcontext *, GLenum );
  513.    void (*SelectTextureCoordSet)( GLcontext *, GLenum );
  514.    void (*SelectTextureTransform)( GLcontext *, GLenum );
  515. };
  516.  
  517.  
  518.  
  519. /* This has to included here. */
  520. #include "dd.h"
  521.  
  522.  
  523. /*
  524.  * Bit flags used for updating material values.
  525.  */
  526. #define FRONT_AMBIENT_BIT     0x1
  527. #define BACK_AMBIENT_BIT      0x2
  528. #define FRONT_DIFFUSE_BIT     0x4
  529. #define BACK_DIFFUSE_BIT      0x8
  530. #define FRONT_SPECULAR_BIT   0x10
  531. #define BACK_SPECULAR_BIT    0x20
  532. #define FRONT_EMISSION_BIT   0x40
  533. #define BACK_EMISSION_BIT    0x80
  534. #define FRONT_SHININESS_BIT 0x100
  535. #define BACK_SHININESS_BIT  0x200
  536. #define FRONT_INDEXES_BIT   0x400
  537. #define BACK_INDEXES_BIT    0x800
  538.  
  539. #define FRONT_MATERIAL_BITS    (FRONT_EMISSION_BIT | FRONT_AMBIENT_BIT | \
  540.                  FRONT_DIFFUSE_BIT | FRONT_SPECULAR_BIT | \
  541.                  FRONT_SHININESS_BIT | FRONT_INDEXES_BIT)
  542.  
  543. #define BACK_MATERIAL_BITS    (BACK_EMISSION_BIT | BACK_AMBIENT_BIT | \
  544.                  BACK_DIFFUSE_BIT | BACK_SPECULAR_BIT | \
  545.                  BACK_SHININESS_BIT | BACK_INDEXES_BIT)
  546.  
  547. #define ALL_MATERIAL_BITS    (FRONT_MATERIAL_BITS | BACK_MATERIAL_BITS)
  548.  
  549.  
  550.  
  551. /*
  552.  * Specular exponent and material shininess lookup table sizes:
  553.  */
  554. #define EXP_TABLE_SIZE 512
  555. #define SHINE_TABLE_SIZE 200
  556.  
  557. struct gl_light {
  558.     GLfloat Ambient[4];        /* ambient color */
  559.     GLfloat Diffuse[4];        /* diffuse color */
  560.     GLfloat Specular[4];        /* specular color */
  561.     GLfloat Position[4];        /* position in eye coordinates */
  562.     GLfloat Direction[4];        /* spotlight dir in eye coordinates */
  563.     GLfloat SpotExponent;
  564.     GLfloat SpotCutoff;        /* in degress */
  565.         GLfloat CosCutoff;        /* = cos(SpotCutoff) */
  566.     GLfloat ConstantAttenuation;
  567.     GLfloat LinearAttenuation;
  568.     GLfloat QuadraticAttenuation;
  569.     GLboolean Enabled;        /* On/off flag */
  570.  
  571.     struct gl_light *NextEnabled;    /* Ptr to next enabled light or NULL */
  572.  
  573.     /* Derived fields */
  574.     GLfloat VP_inf_norm[3];        /* Norm direction to infinite light */
  575.     GLfloat h_inf_norm[3];        /* Norm( VP_inf_norm + <0,0,1> ) */
  576.         GLfloat NormDirection[3];    /* normalized spotlight direction */
  577.         GLfloat SpotExpTable[EXP_TABLE_SIZE][2];  /* to replace a pow() call */
  578.     GLfloat MatAmbient[2][3];    /* material ambient * light ambient */
  579.     GLfloat MatDiffuse[2][3];    /* material diffuse * light diffuse */
  580.     GLfloat MatSpecular[2][3];    /* material spec * light specular */
  581.     GLfloat dli;            /* CI diffuse light intensity */
  582.     GLfloat sli;            /* CI specular light intensity */
  583. };
  584.  
  585.  
  586. struct gl_lightmodel {
  587.     GLfloat Ambient[4];        /* ambient color */
  588.     GLboolean LocalViewer;        /* Local (or infinite) view point? */
  589.     GLboolean TwoSide;        /* Two (or one) sided lighting? */
  590.     GLenum ColorControl;        /* either GL_SINGLE_COLOR */
  591.                     /* or GL_SEPARATE_SPECULAR_COLOR */
  592. };
  593.  
  594.  
  595. struct gl_material {
  596.     GLfloat Ambient[4];
  597.     GLfloat Diffuse[4];
  598.     GLfloat Specular[4];
  599.     GLfloat Emission[4];
  600.     GLfloat Shininess;
  601.     GLfloat AmbientIndex;    /* for color index lighting */
  602.     GLfloat DiffuseIndex;    /* for color index lighting */
  603.     GLfloat SpecularIndex;    /* for color index lighting */
  604.         GLfloat ShineTable[SHINE_TABLE_SIZE];  /* to replace a pow() call */
  605. };
  606.  
  607.  
  608.  
  609. /*
  610.  * Attribute structures:
  611.  *    We define a struct for each attribute group to make pushing and
  612.  *    popping attributes easy.  Also it's a good organization.
  613.  */
  614.  
  615.  
  616. struct gl_accum_attrib {
  617.     GLfloat ClearColor[4];    /* Accumulation buffer clear color */
  618. };
  619.  
  620.  
  621. struct gl_colorbuffer_attrib {
  622.     GLuint ClearIndex;        /* Index to use for glClear */
  623.     GLfloat ClearColor[4];        /* Color to use for glClear */
  624.  
  625.     GLuint IndexMask;        /* Color index write mask */
  626.     GLubyte ColorMask[4];        /* Each flag is 0xff or 0x0 */
  627.         GLboolean SWmasking;        /* Do color/CI masking in software? */
  628.  
  629.     GLenum DrawBuffer;        /* Which buffer to draw into */
  630.  
  631.     /* alpha testing */
  632.     GLboolean AlphaEnabled;        /* Alpha test enabled flag */
  633.     GLenum AlphaFunc;        /* Alpha test function */
  634.     GLubyte AlphaRef;        /* Alpha ref value scaled to [0,255] */
  635.  
  636.     /* blending */
  637.     GLboolean BlendEnabled;        /* Blending enabled flag */
  638.     GLenum BlendSrc;        /* Blending source operator */
  639.     GLenum BlendDst;        /* Blending destination operator */
  640.     GLenum BlendEquation;
  641.     GLfloat BlendColor[4];
  642.     blend_func BlendFunc;        /* Points to C blending function */
  643.  
  644.     /* logic op */
  645.     GLenum LogicOp;            /* Logic operator */
  646.     GLboolean IndexLogicOpEnabled;    /* Color index logic op enabled flag */
  647.     GLboolean ColorLogicOpEnabled;    /* RGBA logic op enabled flag */
  648.     GLboolean SWLogicOpEnabled;    /* Do logic ops in software? */
  649.  
  650.     GLboolean DitherFlag;        /* Dither enable flag */
  651. };
  652.  
  653.  
  654. struct gl_current_attrib {
  655.    GLubyte ByteColor[4];            /* Current RGBA color */
  656.    GLuint Index;                /* Current color index */
  657.    GLfloat Normal[3];                /* Current normal vector */
  658.    GLfloat *TexCoord;                /* points into MultiTexCoord */
  659.    GLfloat MultiTexCoord[MAX_TEX_SETS][4];    /* Current texture coords */
  660.    GLfloat RasterPos[4];            /* Current raster position */
  661.    GLfloat RasterDistance;            /* Current raster distance */
  662.    GLfloat RasterColor[4];            /* Current raster color */
  663.    GLuint RasterIndex;                /* Current raster index */
  664.    GLfloat *RasterTexCoord;            /* Current raster texcoord*/
  665.    GLfloat RasterMultiTexCoord[MAX_TEX_SETS][4];/* Current raster texcoords */
  666.    GLboolean RasterPosValid;            /* Raster po valid flag */
  667.    GLboolean EdgeFlag;                /* Current edge flag */
  668. };
  669.  
  670.  
  671. struct gl_depthbuffer_attrib {
  672.     GLenum Func;        /* Function for depth buffer compare */
  673.     GLfloat Clear;        /* Value to clear depth buffer to */
  674.     GLboolean Test;        /* Depth buffering enabled flag */
  675.     GLboolean Mask;        /* Depth buffer writable? */
  676. };
  677.  
  678.  
  679. struct gl_enable_attrib {
  680.     GLboolean AlphaTest;
  681.     GLboolean AutoNormal;
  682.     GLboolean Blend;
  683.     GLboolean ClipPlane[MAX_CLIP_PLANES];
  684.     GLboolean ColorMaterial;
  685.     GLboolean CullFace;
  686.     GLboolean DepthTest;
  687.     GLboolean Dither;
  688.     GLboolean Fog;
  689.     GLboolean Light[MAX_LIGHTS];
  690.     GLboolean Lighting;
  691.     GLboolean LineSmooth;
  692.     GLboolean LineStipple;
  693.     GLboolean IndexLogicOp;
  694.     GLboolean ColorLogicOp;
  695.     GLboolean Map1Color4;
  696.     GLboolean Map1Index;
  697.     GLboolean Map1Normal;
  698.     GLboolean Map1TextureCoord1;
  699.     GLboolean Map1TextureCoord2;
  700.     GLboolean Map1TextureCoord3;
  701.     GLboolean Map1TextureCoord4;
  702.     GLboolean Map1Vertex3;
  703.     GLboolean Map1Vertex4;
  704.     GLboolean Map2Color4;
  705.     GLboolean Map2Index;
  706.     GLboolean Map2Normal;
  707.     GLboolean Map2TextureCoord1;
  708.     GLboolean Map2TextureCoord2;
  709.     GLboolean Map2TextureCoord3;
  710.     GLboolean Map2TextureCoord4;
  711.     GLboolean Map2Vertex3;
  712.     GLboolean Map2Vertex4;
  713.     GLboolean Normalize;
  714.     GLboolean PointSmooth;
  715.     GLboolean PolygonOffsetPoint;
  716.     GLboolean PolygonOffsetLine;
  717.     GLboolean PolygonOffsetFill;
  718.     GLboolean PolygonSmooth;
  719.     GLboolean PolygonStipple;
  720.     GLboolean RescaleNormals;
  721.     GLboolean Scissor;
  722.     GLboolean Stencil;
  723.     GLuint Texture;
  724.     GLuint TexGen[MAX_TEX_SETS];
  725. };
  726.  
  727.  
  728. struct gl_eval_attrib {
  729.     /* Enable bits */
  730.     GLboolean Map1Color4;
  731.     GLboolean Map1Index;
  732.     GLboolean Map1Normal;
  733.     GLboolean Map1TextureCoord1;
  734.     GLboolean Map1TextureCoord2;
  735.     GLboolean Map1TextureCoord3;
  736.     GLboolean Map1TextureCoord4;
  737.     GLboolean Map1Vertex3;
  738.     GLboolean Map1Vertex4;
  739.     GLboolean Map2Color4;
  740.     GLboolean Map2Index;
  741.     GLboolean Map2Normal;
  742.     GLboolean Map2TextureCoord1;
  743.     GLboolean Map2TextureCoord2;
  744.     GLboolean Map2TextureCoord3;
  745.     GLboolean Map2TextureCoord4;
  746.     GLboolean Map2Vertex3;
  747.     GLboolean Map2Vertex4;
  748.     GLboolean AutoNormal;
  749.     /* Map Grid endpoints and divisions */
  750.     GLint MapGrid1un;
  751.     GLfloat MapGrid1u1, MapGrid1u2;
  752.     GLint MapGrid2un, MapGrid2vn;
  753.     GLfloat MapGrid2u1, MapGrid2u2;
  754.     GLfloat MapGrid2v1, MapGrid2v2;
  755. };
  756.  
  757.  
  758. struct gl_fog_attrib {
  759.     GLboolean Enabled;        /* Fog enabled flag */
  760.     GLfloat Color[4];        /* Fog color */
  761.     GLfloat Density;        /* Density >= 0.0 */
  762.     GLfloat Start;            /* Start distance in eye coords */
  763.     GLfloat End;            /* End distance in eye coords */
  764.     GLfloat Index;            /* Fog index */
  765.     GLenum Mode;            /* Fog mode */
  766. };
  767.  
  768.  
  769. struct gl_hint_attrib {
  770.     /* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */
  771.     GLenum PerspectiveCorrection;
  772.     GLenum PointSmooth;
  773.     GLenum LineSmooth;
  774.     GLenum PolygonSmooth;
  775.     GLenum Fog;
  776. };
  777.  
  778.  
  779. struct gl_light_attrib {
  780.    struct gl_light Light[MAX_LIGHTS];    /* Array of lights */
  781.    struct gl_lightmodel Model;        /* Lighting model */
  782.    struct gl_material Material[2];    /* Material 0=front, 1=back */
  783.    GLboolean Enabled;            /* Lighting enabled flag */
  784.    GLenum ShadeModel;            /* GL_FLAT or GL_SMOOTH */
  785.    GLenum ColorMaterialFace;        /* GL_FRONT, BACK or FRONT_AND_BACK */
  786.    GLenum ColorMaterialMode;        /* GL_AMBIENT, GL_DIFFUSE, etc */
  787.    GLuint ColorMaterialBitmask;        /* bitmask formed from Face and Mode */
  788.    GLboolean ColorMaterialEnabled;
  789.  
  790.    /* Derived for optimizations: */
  791.    struct gl_light *FirstEnabled;    /* Ptr to 1st enabled light */
  792.    GLboolean Fast;            /* Use fast shader? */
  793.    GLfloat BaseColor[2][4];
  794. };
  795.  
  796.  
  797. struct gl_line_attrib {
  798.     GLboolean SmoothFlag;        /* GL_LINE_SMOOTH enabled? */
  799.     GLboolean StippleFlag;        /* GL_LINE_STIPPLE enabled? */
  800.     GLushort StipplePattern;    /* Stipple pattern */
  801.     GLint StippleFactor;        /* Stipple repeat factor */
  802.     GLfloat Width;            /* Line width */
  803. };
  804.  
  805.  
  806. struct gl_list_attrib {
  807.     GLuint ListBase;
  808. };
  809.  
  810.  
  811. struct gl_pixel_attrib {
  812.     GLenum ReadBuffer;        /* src buffer for glRead/CopyPixels */
  813.     GLfloat RedBias, RedScale;
  814.     GLfloat GreenBias, GreenScale;
  815.     GLfloat BlueBias, BlueScale;
  816.     GLfloat AlphaBias, AlphaScale;
  817.     GLboolean ScaleOrBiasRGBA;
  818.     GLfloat DepthBias, DepthScale;
  819.     GLint IndexShift, IndexOffset;
  820.     GLboolean MapColorFlag;
  821.     GLboolean MapStencilFlag;
  822.     GLfloat ZoomX;            /* Pixel zoom X factor */
  823.     GLfloat ZoomY;            /* Pixel zoom Y factor */
  824.     GLint MapStoSsize;        /* Size of each pixel map */
  825.     GLint MapItoIsize;
  826.     GLint MapItoRsize;
  827.     GLint MapItoGsize;
  828.     GLint MapItoBsize;
  829.     GLint MapItoAsize;
  830.     GLint MapRtoRsize;
  831.     GLint MapGtoGsize;
  832.     GLint MapBtoBsize;
  833.     GLint MapAtoAsize;
  834.     GLint MapStoS[MAX_PIXEL_MAP_TABLE];    /* Pixel map tables */
  835.     GLint MapItoI[MAX_PIXEL_MAP_TABLE];
  836.     GLfloat MapItoR[MAX_PIXEL_MAP_TABLE];
  837.     GLfloat MapItoG[MAX_PIXEL_MAP_TABLE];
  838.     GLfloat MapItoB[MAX_PIXEL_MAP_TABLE];
  839.     GLfloat MapItoA[MAX_PIXEL_MAP_TABLE];
  840.     GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE];  /* converted to 8-bit color */
  841.     GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE];
  842.     GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE];
  843.     GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE];
  844.     GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE];
  845.     GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE];
  846.     GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE];
  847.     GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE];
  848. };
  849.  
  850.  
  851. struct gl_point_attrib {
  852.     GLboolean SmoothFlag;    /* True if GL_POINT_SMOOTH is enabled */
  853.     GLfloat Size;        /* Point size */
  854.     GLfloat Params[3];    /* Point Parameters EXT distance atenuation 
  855.                    factors by default = {1,0,0} */ 
  856.     GLfloat MinSize;    /* Default 0.0 always >=0 */
  857.     GLfloat MaxSize;    /* Default MAX_POINT_SIZE */
  858.     GLfloat Threshold;    /* Default 1.0 */ 
  859. };
  860.  
  861.  
  862. struct gl_polygon_attrib {
  863.     GLenum FrontFace;    /* Either GL_CW or GL_CCW */
  864.     GLenum FrontMode;    /* Either GL_POINT, GL_LINE or GL_FILL */
  865.     GLenum BackMode;    /* Either GL_POINT, GL_LINE or GL_FILL */
  866.     GLboolean Unfilled;    /* True if back or front mode is not GL_FILL */
  867.     GLboolean CullFlag;    /* Culling on/off flag */
  868.     GLenum CullFaceMode;    /* Culling mode GL_FRONT or GL_BACK */
  869.         GLuint CullBits;    /* Used for cull testing */
  870.     GLboolean SmoothFlag;    /* True if GL_POLYGON_SMOOTH is enabled */
  871.     GLboolean StippleFlag;    /* True if GL_POLYGON_STIPPLE is enabled */
  872.         GLfloat OffsetFactor;    /* Polygon offset factor */
  873.         GLfloat OffsetUnits;    /* Polygon offset units */
  874.         GLboolean OffsetPoint;    /* Offset in GL_POINT mode? */
  875.         GLboolean OffsetLine;    /* Offset in GL_LINE mode? */
  876.         GLboolean OffsetFill;    /* Offset in GL_FILL mode? */
  877.         GLboolean OffsetAny;    /* OR of OffsetPoint, OffsetLine, OffsetFill */
  878. };
  879.  
  880.  
  881. struct gl_scissor_attrib {
  882.     GLboolean Enabled;        /* Scissor test enabled? */
  883.     GLint X, Y;            /* Lower left corner of box */
  884.     GLsizei Width, Height;        /* Size of box */
  885. };
  886.  
  887.  
  888. struct gl_stencil_attrib {
  889.     GLboolean Enabled;        /* Enabled flag */
  890.     GLenum Function;        /* Stencil function */
  891.     GLenum FailFunc;        /* Fail function */
  892.     GLenum ZPassFunc;        /* Depth buffer pass function */
  893.     GLenum ZFailFunc;        /* Depth buffer fail function */
  894.     GLstencil Ref;            /* Reference value */
  895.     GLstencil ValueMask;        /* Value mask */
  896.     GLstencil Clear;        /* Clear value */
  897.     GLstencil WriteMask;        /* Write mask */
  898. };
  899.  
  900.  
  901. /* TexGenEnabled flags */
  902. #define S_BIT 1
  903. #define T_BIT 2
  904. #define R_BIT 4
  905. #define Q_BIT 8
  906.  
  907. /* Texture Enabled flags */
  908. #define TEXTURE0_1D 0x1     /* Texture set/stage 0 (default) */
  909. #define TEXTURE0_2D 0x2
  910. #define TEXTURE0_3D 0x4
  911. #define TEXTURE1_1D 0x10    /* Texture set/stage 1 */
  912. #define TEXTURE1_2D 0x20
  913. #define TEXTURE1_3D 0x40
  914.  
  915.  
  916. /*
  917.  * The GL_SGIS_multitexture extension introduces the idea of multiple stages
  918.  * of texture application.  In Mesa the state for each stage is stored in
  919.  * a "texture set".  This struct stores the state which is replicated for
  920.  * each texture stage/set.
  921.  *
  922.  * The current set is indicated by the context's Texture.CurrentSet member.
  923.  */
  924. struct gl_texture_set {
  925.    GLenum EnvMode;            /* GL_MODULATE, GL_DECAL, GL_BLEND */
  926.    GLfloat EnvColor[4];
  927.    GLuint TexGenEnabled;        /* Bitwise-OR of [STRQ]_BIT values */
  928.    GLenum GenModeS;            /* Tex coord generation mode, either */
  929.    GLenum GenModeT;            /*    GL_OBJECT_LINEAR, or */
  930.    GLenum GenModeR;            /*    GL_EYE_LINEAR, or    */
  931.    GLenum GenModeQ;            /*      GL_SPHERE_MAP        */
  932.    GLfloat ObjectPlaneS[4];
  933.    GLfloat ObjectPlaneT[4];
  934.    GLfloat ObjectPlaneR[4];
  935.    GLfloat ObjectPlaneQ[4];
  936.    GLfloat EyePlaneS[4];
  937.    GLfloat EyePlaneT[4];
  938.    GLfloat EyePlaneR[4];
  939.    GLfloat EyePlaneQ[4];
  940.    struct gl_texture_object *Current1D;
  941.    struct gl_texture_object *Current2D;
  942.    struct gl_texture_object *Current3D;
  943.    struct gl_texture_object *Current;    /* = Current1D, 2D, 3D or NULL */
  944.  
  945.    /* GL_EXT_multitexture */
  946.    GLint TexCoordSet;            /* in [0, MAX_TEX_COORD_SETS-1] */
  947. };
  948.  
  949.  
  950. struct gl_texture_attrib {
  951.    /* GL_EXT_multitexture */
  952.    GLuint CurrentSet;            /* Current texture set (stage) */
  953.    GLuint CurrentTransformSet;        /* Current texture xform set */
  954.  
  955.    GLuint Enabled;            /* Bitwise-OR of TEXTURE_XD values */
  956.  
  957.    struct gl_texture_set Set[MAX_TEX_SETS];  /* The multitexture stages/sets */
  958.  
  959.    GLboolean AnyDirty;
  960.    struct gl_texture_object *Proxy1D;
  961.    struct gl_texture_object *Proxy2D;
  962.    struct gl_texture_object *Proxy3D;
  963.  
  964.    /* GL_EXT_shared_texture_palette */
  965.    GLboolean SharedPalette;
  966.    GLubyte Palette[MAX_TEXTURE_PALETTE_SIZE*4];
  967.    GLuint PaletteSize;
  968.    GLenum PaletteIntFormat;
  969.    GLenum PaletteFormat;
  970.  
  971.    /* Temporary state for glPush/PopAttrib() only! */
  972.    GLfloat Priority[3];
  973.    GLint BorderColor[3][4];
  974.    GLenum WrapS[3];
  975.    GLenum WrapT[3];
  976.    GLenum WrapR[3];
  977.    GLenum MinFilter[3];
  978.    GLenum MagFilter[3];
  979. };
  980.  
  981.  
  982. struct gl_transform_attrib {
  983.     GLenum MatrixMode;            /* Matrix mode */
  984.     GLfloat ClipEquation[MAX_CLIP_PLANES][4];
  985.     GLboolean ClipEnabled[MAX_CLIP_PLANES];
  986.     GLboolean AnyClip;            /* Any ClipEnabled[] true? */
  987.     GLboolean Normalize;            /* Normalize all normals? */
  988.     GLboolean RescaleNormals;        /* GL_EXT_rescale_normal */
  989. };
  990.  
  991.  
  992. struct gl_viewport_attrib {
  993.     GLint X, Y;        /* position */
  994.     GLsizei Width, Height;    /* size */
  995.     GLfloat Near, Far;    /* Depth buffer range */
  996.     GLfloat Sx, Sy, Sz;    /* NDC to WinCoord scaling */
  997.     GLfloat Tx, Ty, Tz;    /* NDC to WinCoord translation */
  998. };
  999.  
  1000.  
  1001. /* For the attribute stack: */
  1002. struct gl_attrib_node {
  1003.     GLbitfield kind;
  1004.     void *data;
  1005.     struct gl_attrib_node *next;
  1006. };
  1007.  
  1008.  
  1009.  
  1010. /*
  1011.  * Client pixel packing/unpacking attributes
  1012.  */
  1013. struct gl_pixelstore_attrib {
  1014.     GLint Alignment;
  1015.     GLint RowLength;
  1016.     GLint SkipPixels;
  1017.     GLint SkipRows;
  1018.     GLint ImageHeight;     /* for GL_EXT_texture3D */
  1019.     GLint SkipImages;      /* for GL_EXT_texture3D */
  1020.     GLboolean SwapBytes;
  1021.     GLboolean LsbFirst;
  1022. };
  1023.  
  1024.  
  1025. /*
  1026.  * Client vertex array attributes
  1027.  */
  1028. struct gl_array_attrib {
  1029.     GLint VertexSize;
  1030.     GLenum VertexType;
  1031.     GLsizei VertexStride;        /* user-specified stride */
  1032.     GLsizei VertexStrideB;        /* actual stride in bytes */
  1033.     void *VertexPtr;
  1034.     GLboolean VertexEnabled;
  1035.  
  1036.     GLenum NormalType;
  1037.     GLsizei NormalStride;        /* user-specified stride */
  1038.     GLsizei NormalStrideB;        /* actual stride in bytes */
  1039.     void *NormalPtr;
  1040.     GLboolean NormalEnabled;
  1041.  
  1042.     GLint ColorSize;
  1043.     GLenum ColorType;
  1044.     GLsizei ColorStride;        /* user-specified stride */
  1045.     GLsizei ColorStrideB;        /* actual stride in bytes */
  1046.     void *ColorPtr;
  1047.     GLboolean ColorEnabled;
  1048.  
  1049.     GLenum IndexType;
  1050.     GLsizei IndexStride;        /* user-specified stride */
  1051.     GLsizei IndexStrideB;        /* actual stride in bytes */
  1052.     void *IndexPtr;
  1053.     GLboolean IndexEnabled;
  1054.  
  1055.     GLint TexCoordSize[MAX_TEX_SETS];
  1056.     GLenum TexCoordType[MAX_TEX_SETS];
  1057.     GLsizei TexCoordStride[MAX_TEX_SETS];    /* user-specified stride */
  1058.     GLsizei TexCoordStrideB[MAX_TEX_SETS];    /* actual stride in bytes */
  1059.     void *TexCoordPtr[MAX_TEX_SETS];
  1060.     GLboolean TexCoordEnabled[MAX_TEX_SETS];
  1061.     GLint TexCoordInterleaveFactor;
  1062.  
  1063.     GLsizei EdgeFlagStride;        /* user-specified stride */
  1064.     GLsizei EdgeFlagStrideB;    /* actual stride in bytes */
  1065.     GLboolean *EdgeFlagPtr;
  1066.     GLboolean EdgeFlagEnabled;
  1067. };
  1068.  
  1069.  
  1070.  
  1071. struct gl_feedback {
  1072.     GLenum Type;
  1073.     GLuint Mask;
  1074.     GLfloat *Buffer;
  1075.     GLuint BufferSize;
  1076.     GLuint Count;
  1077. };
  1078.  
  1079.  
  1080.  
  1081. struct gl_selection {
  1082.     GLuint *Buffer;
  1083.     GLuint BufferSize;    /* size of SelectBuffer */
  1084.     GLuint BufferCount;    /* number of values in SelectBuffer */
  1085.     GLuint Hits;        /* number of records in SelectBuffer */
  1086.     GLuint NameStackDepth;
  1087.     GLuint NameStack[MAX_NAME_STACK_DEPTH];
  1088.     GLboolean HitFlag;
  1089.     GLfloat HitMinZ, HitMaxZ;
  1090. };
  1091.  
  1092.  
  1093.  
  1094. /*
  1095.  * 1-D Evaluator control points
  1096.  */
  1097. struct gl_1d_map {
  1098.     GLuint Order;        /* Number of control points */
  1099.     GLfloat u1, u2;
  1100.     GLfloat *Points;    /* Points to contiguous control points */
  1101.     GLboolean Retain;    /* Reference counter */
  1102. };
  1103.     
  1104.  
  1105. /*
  1106.  * 2-D Evaluator control points
  1107.  */
  1108. struct gl_2d_map {
  1109.     GLuint Uorder;        /* Number of control points in U dimension */
  1110.     GLuint Vorder;        /* Number of control points in V dimension */
  1111.     GLfloat u1, u2;
  1112.     GLfloat v1, v2;
  1113.     GLfloat *Points;    /* Points to contiguous control points */
  1114.     GLboolean Retain;    /* Reference counter */
  1115. };
  1116.  
  1117.  
  1118. /*
  1119.  * All evalutator control points
  1120.  */
  1121. struct gl_evaluators {
  1122.     /* 1-D maps */
  1123.     struct gl_1d_map Map1Vertex3;
  1124.     struct gl_1d_map Map1Vertex4;
  1125.     struct gl_1d_map Map1Index;
  1126.     struct gl_1d_map Map1Color4;
  1127.     struct gl_1d_map Map1Normal;
  1128.     struct gl_1d_map Map1Texture1;
  1129.     struct gl_1d_map Map1Texture2;
  1130.     struct gl_1d_map Map1Texture3;
  1131.     struct gl_1d_map Map1Texture4;
  1132.  
  1133.     /* 2-D maps */
  1134.     struct gl_2d_map Map2Vertex3;
  1135.     struct gl_2d_map Map2Vertex4;
  1136.     struct gl_2d_map Map2Index;
  1137.     struct gl_2d_map Map2Color4;
  1138.     struct gl_2d_map Map2Normal;
  1139.     struct gl_2d_map Map2Texture1;
  1140.     struct gl_2d_map Map2Texture2;
  1141.     struct gl_2d_map Map2Texture3;
  1142.     struct gl_2d_map Map2Texture4;
  1143. };
  1144.  
  1145.  
  1146.  
  1147. /* Texture object record */
  1148. struct gl_texture_object {
  1149.     GLint RefCount;            /* reference count */
  1150.     GLuint Name;            /* an unsigned integer */
  1151.     GLuint Dimensions;        /* 1 or 2 or 3 */
  1152.     GLfloat Priority;        /* in [0,1] */
  1153.     GLint BorderColor[4];        /* as integers in [0,255] */
  1154.     GLenum WrapS;            /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */
  1155.     GLenum WrapT;            /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */
  1156.     GLenum WrapR;            /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */
  1157.     GLenum MinFilter;        /* minification filter */
  1158.     GLenum MagFilter;        /* magnification filter */
  1159.     GLfloat MinLod;            /* OpenGL 1.2 */
  1160.     GLfloat MaxLod;            /* OpenGL 1.2 */
  1161.     GLint BaseLevel;        /* OpenGL 1.2 */
  1162.     GLint MaxLevel;            /* OpenGL 1.2 */
  1163.     GLint P;            /* Highest mipmap level */
  1164.     GLfloat M;            /* = MIN(MaxLevel, P) - BaseLevel */
  1165.     GLfloat MinMagThresh;        /* min/mag threshold */
  1166.     struct gl_texture_image *Image[MAX_TEXTURE_LEVELS];
  1167.  
  1168.     /* GL_EXT_paletted_texture */
  1169.     GLubyte Palette[MAX_TEXTURE_PALETTE_SIZE*4];
  1170.     GLuint PaletteSize;
  1171.     GLenum PaletteIntFormat;
  1172.     GLenum PaletteFormat;
  1173.  
  1174.     /* For device driver: */
  1175.     GLboolean Dirty;    /* Set when any texobj state changes */
  1176.     void *DriverData;    /* Arbitrary device driver data */
  1177.  
  1178.     GLboolean Complete;        /* Complete set of images? */
  1179.     TextureSampleFunc SampleFunc;
  1180.     struct gl_texture_object *Next;    /* Next in linked list */
  1181. };
  1182.  
  1183.  
  1184.  
  1185. /*
  1186.  * State which can be shared by multiple contexts:
  1187.  */
  1188. struct gl_shared_state {
  1189.    GLint RefCount;               /* Reference count */
  1190.    struct HashTable *DisplayList;       /* Display lists hash table */
  1191.    struct HashTable *TexObjects;       /* Texture objects hash table */
  1192.    struct gl_texture_object *TexObjectList;/* Linked list of texture objects */
  1193.  
  1194.    /* Default texture objects */
  1195.    struct gl_texture_object *Default1D[MAX_TEX_SETS];
  1196.    struct gl_texture_object *Default2D[MAX_TEX_SETS];
  1197.    struct gl_texture_object *Default3D[MAX_TEX_SETS];
  1198. };
  1199.  
  1200.  
  1201.  
  1202. /*
  1203.  * Describes the color, depth, stencil and accum buffer parameters.
  1204.  * In C++ terms, think of this as a base class from which device drivers
  1205.  * will make derived classes.
  1206.  */
  1207. struct gl_visual {
  1208.     GLboolean RGBAflag;    /* Is frame buffer in RGBA mode, not CI? */
  1209.     GLboolean DBflag;    /* Is color buffer double buffered? */
  1210.     GLboolean StereoFlag;    /* stereo buffer? */
  1211.  
  1212.     GLint RedBits;        /* Bits per color component */
  1213.     GLint GreenBits;
  1214.     GLint BlueBits;
  1215.     GLint AlphaBits;
  1216.  
  1217.     GLint IndexBits;    /* Bits/pixel if in color index mode */
  1218.  
  1219.     GLint AccumBits;    /* Number of bits per color channel, or 0 */
  1220.     GLint DepthBits;    /* Number of bits in depth buffer, or 0 */
  1221.     GLint StencilBits;    /* Number of bits in stencil buffer, or 0 */
  1222.  
  1223.     /* Software alpha planes: */
  1224.     GLboolean FrontAlphaEnabled;
  1225.     GLboolean BackAlphaEnabled;
  1226. };
  1227.  
  1228.  
  1229.  
  1230. /*
  1231.  * A "frame buffer" is a color buffer and its optional ancillary buffers:
  1232.  * depth, accum, stencil, and software-simulated alpha buffers.
  1233.  * In C++ terms, think of this as a base class from which device drivers
  1234.  * will make derived classes.
  1235.  */
  1236. struct gl_frame_buffer {
  1237.     GLvisual *Visual;    /* The corresponding visual */
  1238.  
  1239.     GLint Width;        /* Width of frame buffer in pixels */
  1240.     GLint Height;        /* Height of frame buffer in pixels */
  1241.  
  1242.     GLdepth *Depth;        /* array [Width*Height] of GLdepth values */
  1243.  
  1244.     /* Stencil buffer */
  1245.     GLstencil *Stencil;    /* array [Width*Height] of GLstencil values */
  1246.  
  1247.     /* Accumulation buffer */
  1248.     GLaccum *Accum;        /* array [4*Width*Height] of GLaccum values */
  1249.  
  1250.     /* Software alpha planes: */
  1251.     GLubyte *FrontAlpha;    /* array [Width*Height] of GLubyte */
  1252.     GLubyte *BackAlpha;    /* array [Width*Height] of GLubyte */
  1253.     GLubyte *Alpha;        /* Points to front or back alpha buffer */
  1254.  
  1255.     /* Drawing bounds: intersection of window size and scissor box */
  1256.     GLint Xmin, Xmax, Ymin, Ymax;
  1257. };
  1258.  
  1259.  
  1260.  
  1261. /*
  1262.  * Bitmasks to indicate what auxillary information must be interpolated
  1263.  * when clipping (ClipMask).
  1264.  */
  1265. #define CLIP_FCOLOR_BIT        0x01
  1266. #define CLIP_BCOLOR_BIT        0x02
  1267. #define CLIP_FINDEX_BIT        0x04
  1268. #define CLIP_BINDEX_BIT        0x08
  1269. #define CLIP_TEXTURE_BIT    0x10
  1270.  
  1271.  
  1272.  
  1273. /*
  1274.  * Bitmasks to indicate which rasterization options are enabled (RasterMask)
  1275.  */
  1276. #define ALPHATEST_BIT        0x001    /* Alpha-test pixels */
  1277. #define BLEND_BIT        0x002    /* Blend pixels */
  1278. #define DEPTH_BIT        0x004    /* Depth-test pixels */
  1279. #define FOG_BIT            0x008    /* Per-pixel fog */
  1280. #define LOGIC_OP_BIT        0x010    /* Apply logic op in software */
  1281. #define SCISSOR_BIT        0x020    /* Scissor pixels */
  1282. #define STENCIL_BIT        0x040    /* Stencil pixels */
  1283. #define MASKING_BIT        0x080    /* Do glColorMask() or glIndexMask() */
  1284. #define ALPHABUF_BIT        0x100    /* Using software alpha buffer */
  1285. #define WINCLIP_BIT        0x200    /* Clip pixels/primitives to window */
  1286. #define FRONT_AND_BACK_BIT    0x400    /* Write to front and back buffers */
  1287. #define NO_DRAW_BIT        0x800    /* Don't write any pixels */
  1288.  
  1289.  
  1290. /*
  1291.  * Bits to indicate what state has to be updated (NewState)
  1292.  */
  1293. #define NEW_LIGHTING    0x01
  1294. #define NEW_RASTER_OPS    0x02
  1295. #define NEW_TEXTURING    0x04
  1296. #define NEW_POLYGON    0x08
  1297. #define NEW_DRVSTATE0    0x10 /* Reserved for drivers */
  1298. #define NEW_DRVSTATE1    0x20 /* Reserved for drivers */
  1299. #define NEW_DRVSTATE2    0x40 /* Reserved for drivers */
  1300. #define NEW_DRVSTATE3    0x80 /* Reserved for drivers */
  1301. #define NEW_ALL        0xff
  1302.  
  1303.  
  1304. /*
  1305.  * Different kinds of 4x4 transformation matrices:
  1306.  */
  1307. #define MATRIX_GENERAL        0    /* general 4x4 matrix */
  1308. #define MATRIX_IDENTITY        1    /* identity matrix */
  1309. #define MATRIX_ORTHO        2    /* orthographic projection matrix */
  1310. #define MATRIX_PERSPECTIVE    3    /* perspective projection matrix */
  1311. #define MATRIX_2D        4    /* 2-D transformation */
  1312. #define MATRIX_2D_NO_ROT    5    /* 2-D scale & translate only */
  1313. #define MATRIX_3D        6    /* 3-D transformation */
  1314.  
  1315.  
  1316. /*
  1317.  * FogMode values:
  1318.  */
  1319. #define FOG_NONE    0    /* no fog */
  1320. #define FOG_VERTEX    1    /* apply per vertex */
  1321. #define FOG_FRAGMENT    2    /* apply per fragment */
  1322.  
  1323.  
  1324. /*
  1325.  * Forward declaration of display list datatypes:
  1326.  */
  1327. union node;
  1328. typedef union node Node;
  1329.  
  1330.  
  1331.  
  1332. /*
  1333.  * The library context: 
  1334.  */
  1335.  
  1336. struct gl_context {
  1337.     /* State possibly shared with other contexts in the address space */
  1338.     struct gl_shared_state *Shared;
  1339.  
  1340.     /* API function pointer tables */
  1341.     struct gl_api_table API;        /* For api.c */
  1342.     struct gl_api_table Save;        /* Display list save funcs */
  1343.     struct gl_api_table Exec;        /* Execute funcs */
  1344.  
  1345.         GLvisual *Visual;
  1346.         GLframebuffer *Buffer;
  1347.  
  1348.     /* Driver function pointer table */
  1349.     struct dd_function_table Driver;
  1350.  
  1351.     void *DriverCtx;    /* Points to device driver context/state */
  1352.     void *DriverMgrCtx;    /* Points to device driver manager (optional)*/
  1353.  
  1354.     /* Modelview matrix and stack */
  1355.     GLboolean NewModelViewMatrix;
  1356.     GLuint ModelViewMatrixType;    /* = one of MATRIX_* values */
  1357.     GLfloat ModelViewMatrix[16];
  1358.     GLfloat ModelViewInv[16];    /* Inverse of ModelViewMatrix */
  1359.     GLuint ModelViewStackDepth;
  1360.     GLfloat ModelViewStack[MAX_MODELVIEW_STACK_DEPTH][16];
  1361.  
  1362.     /* Projection matrix and stack */
  1363.     GLboolean NewProjectionMatrix;
  1364.     GLuint ProjectionMatrixType;    /* = one of MATRIX_* values */
  1365.     GLfloat ProjectionMatrix[16];
  1366.     GLuint ProjectionStackDepth;
  1367.     GLfloat ProjectionStack[MAX_PROJECTION_STACK_DEPTH][16];
  1368.     GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH][2];
  1369.  
  1370.     /* Texture matrix and stack */
  1371.     GLboolean NewTextureMatrix;
  1372.     GLuint TextureMatrixType[MAX_TEX_COORD_SETS];    /* = MATRIX_* */
  1373.     GLfloat TextureMatrix[MAX_TEX_COORD_SETS][16];
  1374.     GLuint TextureStackDepth[MAX_TEX_COORD_SETS];
  1375.     GLfloat TextureStack[MAX_TEX_COORD_SETS][MAX_TEXTURE_STACK_DEPTH][16];
  1376.  
  1377.     /* Display lists */
  1378.     GLuint CallDepth;    /* Current recursion calling depth */
  1379.     GLboolean ExecuteFlag;    /* Execute GL commands? */
  1380.     GLboolean CompileFlag;    /* Compile GL commands into display list? */
  1381.     Node *CurrentListPtr;    /* Head of list being compiled */
  1382.     GLuint CurrentListNum;    /* Number of the list being compiled */
  1383.     Node *CurrentBlock;    /* Pointer to current block of nodes */
  1384.     GLuint CurrentPos;    /* Index into current block of nodes */
  1385.  
  1386.     /* Renderer attribute stack */
  1387.     GLuint AttribStackDepth;
  1388.     struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH];
  1389.  
  1390.     /* Renderer attribute groups */
  1391.     struct gl_accum_attrib        Accum;
  1392.     struct gl_colorbuffer_attrib    Color;
  1393.     struct gl_current_attrib    Current;
  1394.     struct gl_depthbuffer_attrib    Depth;
  1395.     struct gl_eval_attrib        Eval;
  1396.     struct gl_fog_attrib        Fog;
  1397.     struct gl_hint_attrib        Hint;
  1398.     struct gl_light_attrib        Light;
  1399.     struct gl_line_attrib        Line;
  1400.     struct gl_list_attrib        List;
  1401.     struct gl_pixel_attrib        Pixel;
  1402.     struct gl_point_attrib        Point;
  1403.     struct gl_polygon_attrib    Polygon;
  1404.     GLuint PolygonStipple[32];
  1405.     struct gl_scissor_attrib    Scissor;
  1406.     struct gl_stencil_attrib    Stencil;
  1407.     struct gl_texture_attrib    Texture;
  1408.     struct gl_transform_attrib    Transform;
  1409.     struct gl_viewport_attrib    Viewport;
  1410.  
  1411.     /* Client state - GL_EXT_multitexture */
  1412.     GLuint TexCoordSet;        /* Target of glTexCoord() functions */
  1413.  
  1414.     /* Client attribute stack */
  1415.     GLuint ClientAttribStackDepth;
  1416.     struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH];
  1417.  
  1418.     /* Client attribute groups */
  1419.     struct gl_array_attrib        Array;    /* Vertex arrays */
  1420.     struct gl_pixelstore_attrib    Pack;    /* Pixel packing */
  1421.     struct gl_pixelstore_attrib    Unpack;    /* Pixel unpacking */
  1422.  
  1423.     struct gl_evaluators EvalMap;    /* All evaluators */
  1424.     struct gl_feedback Feedback;    /* Feedback */
  1425.     struct gl_selection Select;    /* Selection */
  1426.  
  1427.     GLenum ErrorValue;        /* Last error code */
  1428.  
  1429.     GLboolean DirectContext;    /* Important for real GLX */
  1430.  
  1431.     /* Miscellaneous */
  1432.         GLuint NewState;        /* bitwise OR of NEW_* flags */
  1433.     GLenum RenderMode;    /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */
  1434.     GLenum Primitive;    /* glBegin primitive or GL_BITMAP */
  1435.     GLuint StippleCounter;    /* Line stipple counter */
  1436.     GLuint ClipMask;    /* OR of CLIP_* values from above */
  1437.     GLuint RasterMask;    /* OR of rasterization flags */
  1438.     GLboolean LightTwoSide;    /* Compute two-sided lighting? */
  1439.     GLboolean DirectTriangles;/* Directly call (*ctx->TriangleFunc) ? */
  1440.     GLfloat PolygonZoffset;    /* Z offset for GL_FILL polygons */
  1441.     GLfloat LineZoffset;    /* Z offset for GL_LINE polygons */
  1442.     GLfloat PointZoffset;    /* Z offset for GL_POINT polygons */
  1443.     GLboolean NeedNormals;    /* Are vertex normal vectors needed? */
  1444.         GLboolean MutablePixels;/* Can rasterization change pixel's color? */
  1445.         GLboolean MonoPixels;   /* Are all pixels likely to be same color? */
  1446.     GLuint FogMode;         /* FOG_OFF, FOG_VERTEX or FOG_FRAGMENT */
  1447.  
  1448.     GLboolean DoViewportMapping;
  1449.  
  1450.     /* Points to function which interpolates colors, etc when clipping */
  1451.     clip_interp_func ClipInterpFunc;
  1452.  
  1453.         /* The vertex buffer being used by this context */
  1454.         struct vertex_buffer* VB;
  1455.  
  1456.         /* The pixel buffer being used by this context */
  1457.         struct pixel_buffer* PB;
  1458.  
  1459. #ifdef PROFILE
  1460.         /* Performance measurements */
  1461.         GLuint BeginEndCount;    /* number of glBegin/glEnd pairs */
  1462.         GLdouble BeginEndTime;    /* seconds spent between glBegin/glEnd */
  1463.         GLuint VertexCount;    /* number of vertices processed */
  1464.         GLdouble VertexTime;    /* total time in seconds */
  1465.         GLuint PointCount;    /* number of points rendered */
  1466.         GLdouble PointTime;    /* total time in seconds */
  1467.         GLuint LineCount;    /* number of lines rendered */
  1468.         GLdouble LineTime;    /* total time in seconds */
  1469.         GLuint PolygonCount;    /* number of polygons rendered */
  1470.         GLdouble PolygonTime;    /* total time in seconds */
  1471.         GLuint ClearCount;    /* number of glClear calls */
  1472.         GLdouble ClearTime;    /* seconds spent in glClear */
  1473.         GLuint SwapCount;    /* number of swap-buffer calls */
  1474.         GLdouble SwapTime;    /* seconds spent in swap-buffers */
  1475. #endif
  1476.  
  1477.         /* For debugging/development only */
  1478.         GLboolean NoRaster;
  1479.  
  1480.         /* Dither disable via MESA_NO_DITHER env var */
  1481.         GLboolean NoDither;
  1482. };
  1483.  
  1484.  
  1485. #endif
  1486.